import React, { Component } from 'react'
import PropTypes from 'prop-types'

export default class index extends Component {
    /**
     * 属性验证
     */
    static propTypes = {
        item: PropTypes.object.isRequired,
        index: PropTypes.number.isRequired,
        deleteComment: PropTypes.func.isRequired
    }

    handleDelete=()=>{
        this.props.deleteComment(this.props.index)
    }

    render() {
        return (
            <div>
                <div className="panel panel-default">
                    <div className="panel-heading">{this.props.item.name}说
                        <button type="button" className="btn btn-link" onClick={this.handleDelete}>删除</button>
                    </div>
                    <div className="panel-body">
                        {this.props.item.content}
                    </div>
                </div>
            </div>
        )
    }
}
